<template>
    <view>
        <!-- search -->

        <view class="container_2">
            <view class="header_2">
                <navigator url="../city/index?id=1" hover-class="none">
                    <view class="city_2">
                        <text class="fa fa-map-marker fa-lg"></text>
                        {{ city }}
                    </view>
                </navigator>
                <view class="search_2" @tap="toSelectJob">
                    <icon style="margin-top: 0;" type="search" size="14" />
                    <view>请搜索职位名称</view>
                </view>
            </view>

            <!-- 列表 -->
            <view class="news">
                <!-- parse <template is="ejoblist" v-if="joblist" :data="joblist"/> -->
                <block name="ejoblist"  v-if="joblist">
                    <view class="joblist_2" v-for="(item, index) in joblist" :key="index">
                        <view class="title_2" @tap="toJobDetail" :data-id="item.id">
                            <view class="jobinfo_2">
                                <view class="jobinfoleft_2">
                                    <view class="address_2">
                                        <view class="jobname_2">{{ item.jobtitle }}</view>

                                        <view class="moneyinfo_2">
                                            <block v-if="item.money == 0">面议</block>
                                            <block v-else>{{ item.money }}</block>
                                        </view>
                                        <view class="vprice2"></view>
                                    </view>

                                    <view class="joblable_2">{{ item.areaname }} | {{ item.education }}</view>

                                    <view class="special_2">
                                        <view class="items_2" v-for="(itemSpecial, index1) in item.speciallist" :key="index1">{{ itemSpecial }}</view>

                                        <!--
                                                    <view class="items_2" >月休</view> 
                                                    <view class="items_2" >免费培训</view>
                                                    <view class="items_2" >晋升空间</view>
                                                    <view class="items_2" >综合补贴</view>
                                                       -->
                                    </view>
                                </view>

                                <view class="jobinforight_2">
                                    <view class="fxmoney_2" v-if="item.vprice > 0">
                                        <view style="width: 200rpx; color: #fff">推荐奖300元/人</view>
                                        <view>入职奖100元/人</view>
                                    </view>
                                </view>
                            </view>

                            <view class="detail_2">
                                <view class="info_2">
                                    <view class="companyinfo_2" style="font-size: 0.9rem">
                                        {{ item.companyname }}
                                    </view>
                                    <view class="jobmoney_2">
                                        <view class="time_2">{{ item.updatetime }}</view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                </block>
            </view>
        </view>

        <!-- 加载更多 -->
        <view class="loadmore">
            <text>{{ loadMore }}</text>
        </view>

        <!-- <view class="u-tap-btn">
            <button class="u-go-home2" open-type="contact">
                <view class="iconfont fa fa-comments-o"></view>
            </button>
        </view> -->
    </view>
</template>

<script>
import { Job } from '../../model/job-model.js';
var job = new Job();
export default {
    data() {
        return {
            city: uni.getStorageSync('companyinfo').city,
            page: 1,
            cateid: 0,
            priceid: 0,
            edu: '',
            express: '',
            sex: -1,
            special: '',
            joblist: '',
            loadMore: ''
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (e) {
        var that = this;
        that.cateid = e.cateid;
        that.priceid = e.priceid;
        that.edu = e.edu;
        that.express = e.express;
        that.sex = e.sex;
        that.special = e.special;
        uni.setNavigationBarTitle({
            title: '职位筛选'
        });
        uni.showShareMenu({
            withShareTicket: true,
            menus: ['shareAppMessage', 'shareTimeline']
        });
        var cityinfo = uni.getStorageSync('cityinfo');
        console.log(cityinfo);
        if (cityinfo) {
            uni.setStorageSync('city', cityinfo.name);
            that.setData({
                city: uni.getStorageSync('cityinfo').name
            });
        } else {
        }
        var cityid = uni.getStorageSync('cityinfo').id;
        that.cateid = e.cateid;
        that.priceid = e.priceid;
        that.edu = e.edu;
        that.express = e.express;
        that.sex = e.sex;
        that.special = e.special;
        var params = {
            cityid: cityid,
            page: that.page,
            priceid: that.priceid,
            cateid: that.cateid,
            edu: that.edu,
            express: that.express,
            sex: that.sex,
            special: that.special,
            type: 0
        };
        job.getSearchJobListData((data) => {
            console.log(data);
            that.setData({
                joblist: data.joblist
            });
        }, params);
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {
        return {
            title: '找工作',
            path: '/pages/findjob/index'
        };
    },
    methods: {
        getjoblist: function () {
            var that = this;
            var cityid = uni.getStorageSync('cityinfo').id;
            var latitude = uni.getStorageSync('latitude');
            var longitude = uni.getStorageSync('longitude');
            var params = {
                cityid: cityid,
                page: that.page,
                areaid: that.areaid,
                priceid: that.priceid,
                jobcateid: that.cateid,
                latitude: latitude,
                longitude: longitude
            };
            findjob.getJobListData((data) => {
                console.log(data);
                that.setData({
                    joblist: data.joblist
                });
            }, params);
        },

        toJobDetail: function (e) {
            var id = e.currentTarget.dataset.id;
            uni.navigateTo({
                url: '/pages/jobdetail/index?id=' + id
            });
        },

        toSelectJob() {
            console.log('占位：函数 toSelectJob 未声明');
        }
    }
};
</script>
<style>
@import '../templates/css/index_2.css'; /* search */
/**app.wxss**/
page {
    background-size: 100% 100%;
    height: 100%;
    font-size: 32rpx;
    font-family: '微软雅黑', '方正黑体';
    color: #333;
}

.container_2 {
    background-color: #f0f1f5;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/*
.search image {
	width: 30rpx;
	height: 34rpx;
	padding-right: 3px;
	vertical-align: sub;
}

.search text {
	line-height: 30px;
	font-size: 14px;
	color: #e62129;
}

.search_box {
	display: flex;
	flex: 1;
	height: 30px;
	padding-left: 15px;
	margin: 10px 0 0 10px;
	background-color: #f7f7f7;
}

.search_box icon {
	padding-top: 8px;
}

.search_box text {
	flex: 1;
	padding-left: 5px;
	color: #999;
}

*/

.header_2 {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    padding-top: 30rpx;
    padding-bottom: 30rpx;
    background: #fff;
}
.header_2_fixed {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    padding-top: 30rpx;
    padding-bottom: 30rpx;
    background: #fff;
    position: fixed;
    z-index: 100;
    top: 0px;
}

.city_2 {
    height: 80rpx;
    line-height: 80rpx;
    color: #000000;
    font-size: 0.9rem;
    font-weight: 600;
}
.search_2 {
    width: 500rpx;
    height: 80rpx;
    line-height: 80rpx;
    background: #f0f1f5;
    display: flex;
    flex-direction: row;
    justify-content: center;
    border-radius: 30rpx 30rpx 30rpx 0rpx;
}
.search_2 view {
    color: #a6a6a6;
    font-size: 0.7rem;
    align-self: center;
}
.search_2 icon {
    margin-right: 20rpx;
    margin-top: 18rpx;
}

.selectcars {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    padding: 20rpx;
    font-size: 0.8rem;
    background: #ffffff;
}
.selectcars_fixed {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    padding: 20rpx;
    font-size: 0.8rem;

    z-index: 1112;
    position: fixed;
    top: 120rpx;
    background: #fff;
}

.itemselectcars {
    display: flex;
    flex-direction: row;
    height: 60rpx;
    justify-content: center;
    align-items: center;
    width: 24%;
}

.itemselectcars image {
    width: 15rpx;
    height: 15rpx;
    align-self: center;
    margin-left: 5rpx;
}

.red {
    color: #fd6a36;
}

.select_cars,
.select_sort,
.select_price {
    position: fixed;
    top: 90px;
    left: 0px;
    z-index: 888;
    width: 100%;
    padding-left: 30rpx;

    background-color: #fff;
}

.select_cars text,
.select_sort text {
    display: block;
    flex: 1;
    line-height: 35px;
    font-size: 13px;
}

.select_cars text:last-child,
.select_sort text:last-child {
    border-bottom: 0;
}

.select_cars_list {
    display: flex;
    border-bottom: 1px solid #ececec;
}

.select_cars_list image {
    width: 12px;
    height: 22px;
    padding-top: 8px;
    margin-right: 30rpx;
}
.select {
    border-bottom: 1px solid #e62129;
}

.select text {
    color: #e62129;
}

.select_price {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    padding: 6px 4%;
    padding-top: 30rpx;
}
.select_price .item {
    height: 80rpx;
    background: #f3f3f3;
    padding-left: 15rpx;
    padding-right: 15rpx;
    border-radius: 35rpx;
    margin-right: 22rpx;
    margin-bottom: 20rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
}

/* 遮罩层 */
.small_overlay {
    position: fixed;
    width: 100%;
    height: 80%;
    bottom: 0;
    left: 0;
    z-index: 666;
    background-color: rgba(0, 0, 0, 0.5);
}

@import 'undefined';
</style>
